<?php

namespace app\admin\model;

use think\Model;
use traits\model\SoftDelete;

class Dxzfshouru extends Model
{

    use SoftDelete;

    

    // 表名
    protected $name = 'dxzfshouru';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [
        'shouru_text',
        'stype_text'
    ];
    

    
    public function getShouruList()
    {
        return ['1' => __('Shouru 1'), '2' => __('Shouru 2'), '3' => __('Shouru 3'), '4' => __('Shouru 4'), '5' => __('Shouru 5'), '0' => __('Shouru 0')];
    }

    public function getStypeList()
    {
        return ['1' => __('Stype 1'), '2' => __('Stype 2'), '3' => __('Stype 3')];
    }


    public function getShouruTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['shouru']) ? $data['shouru'] : '');
        $list = $this->getShouruList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['stype']) ? $data['stype'] : '');
        $list = $this->getStypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public  function getStypeValue($v)
    {
        $list = $this->getStypeList();
        return isset($list[$v]) ? $list[$v] : '';
    }



}
